export default function createDistrictSchema(label, config, required){
    return {
        type: 'input-group',
        label: label || '注册地址',
        ...config,
        required: required,
        name: '__district',
        body:[
            {
                type: 'select',
                name: 'provinceCode',
                source: {
                    method: 'get',
                    url: '${API_HOST}/base/district/province',
                    cache: 1000 * 60 * 60
                },
                labelField: 'regionName',
                valueField: 'regionCode',
                required: true,
                validationErrors: {
                    isRequired: '请选择省'
                },
            },
            {
                type: 'select',
                name: 'cityCode',
                clearable: true,
                source: {
                    method: 'get',
                    sendOn: '${provinceCode}',
                    url: '${API_HOST}/base/district/children?parentId=${provinceCode}',
                    cache: 1000 * 60 * 60
                },
                labelField: 'regionName',
                valueField: 'regionCode',
                required: true,
                validationErrors: {
                    isRequired: '请选择市'
                },
            },
            {
                type: 'select',
                name: 'areaCode',
                clearable: true,
                source: {
                    method: 'get',
                    sendOn: '${cityCode}',
                    url: '${API_HOST}/base/district/children?parentId=${cityCode}',
                    cache: 1000 * 60 * 60
                },
                labelField: 'regionName',
                valueField: 'regionCode',
                required: true,
                validationErrors: {
                    isRequired: '请选择县'
                },
            }
        ]
    }
}  